#define quickread
#ifdef quickread
#include <cstdio> 
template <typename T>
inline void read(T& x)
{
    int c=getchar(), f=1; x=0;
    while(c<'0'||'9'<c) {if(c=='-') f=-1; c=getchar();}
    while('0'<=c&&c<='9') 
        x=(x<<3)+(x<<1)+c-'0', c=getchar();
    x*=f;
}
template <typename T>
inline void quickwrite(T x)
{
    if(x<0) putchar('-'), x*=-1;
    if(x>=10) quickwrite(x/10);
    putchar(x%10+'0');
}
#else 
#include <iostream>
#endif
#include <cmath>
using namespace std;
#define DEBUG
#define min3(a, b, c) (min(a, min(b, c)))
#define cal(a, b, c) (1ll*abs(a-b)+1ll*abs(b-c)+1ll*abs(a-c))
#define int long long
const int N=1e5+10, INF=1e18;
int l, m, n, ans=INF;
int S1[N], S2[N], S3[N];

void init()
{
    read(l), read(m), read(n);
    for(int i=1; i<=l; i++) read(S1[i]);
    for(int i=1; i<=m; i++) read(S2[i]);
    for(int i=1; i<=n; i++) read(S3[i]);

}

void solve()
{
    init();
    int i1=1, i2=1, i3=1;
    while(i1<=l&&i2<=m&&i3<=n)
    {
        int a=S1[i1], b=S2[i2], c=S3[i3];
        ans=min(ans, cal(a, b, c));
        int mi=min3(a, b, c);
        if(mi==a) i1++;
        else if(mi==b) i2++;
        else i3++;
    }
    quickwrite(ans); puts("");
}

// #undef DEBUG
signed main()
{
    #ifdef DEBUG
        freopen("./in.txt", "r", stdin);
        freopen("./out.txt", "w", stdout);
    #endif
    #ifndef quickread
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #endif

    int T=1; //scanf("%d", &T);
    while(T--) 
    {
        solve();
    }
    return 0;
}
